package com.qingcloud.adminbackend.controller;

import com.qingcloud.adminbackend.base.AjaxResult;
import com.qingcloud.adminbackend.constant.WamingConstant;
import com.qingcloud.adminbackend.entity.monitordata.MonitorDataBO;
import com.qingcloud.adminbackend.entity.monitordata.MonitorDataDTO;
import com.qingcloud.adminbackend.service.IWeatherDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(value = "监测数据管理", description = "监测数据管理")
@RestController
@RequestMapping("/weatherdata")
public class MonitorDataController {

    @Resource
    private IWeatherDataService weatherDataService;

    @Value("${file.rootpath}")
    private String ROOTPATH;

    @ApiOperation(value = "监测数据列表API", notes = "监测数据列表API", response = MonitorDataDTO.class)
    @PostMapping("/findMonitorData")
    public AjaxResult findMonitorData(@RequestBody MonitorDataBO monitorDataBO) {
        return new AjaxResult(WamingConstant.SUCCESS, "", weatherDataService.getMonitorData(monitorDataBO));
    }

    @ApiOperation(value = "监测数据下拉API", notes = "监测数据下拉API")
    @PostMapping("/findMonitorDataList")
    public AjaxResult findMonitorDataList() {
        return new AjaxResult(WamingConstant.SUCCESS, "", weatherDataService.findMonitorDataList());
    }
}
